package com.tank.jdk8.stream;

import java.util.Arrays;
import java.util.List;

/**
 * Created with IntelliJ IDEA.
 * User: SuQiEr
 * Date:2017/1/29
 * Time: 16:07
 * To change this template use File | Settings | File Templates.
 */
public class StreamTest {

    public static void main(String[] args) {

        //遍历并乘以2累加
        List<Integer> list = Arrays.asList(1,2,3,4);

        System.out.println(list.stream().map(i -> i*2).reduce(0,Integer::sum));
    }
}

